/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package Model;

import java.io.Serializable;
import java.math.BigDecimal;
import java.math.BigInteger;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;

/**
 *
 * @author ODHeroes
 */
@Entity
@Table(name = "publicaciones")
@NamedQueries({
    @NamedQuery(name = "Publicaciones.findAll", query = "SELECT p FROM Publicaciones p"),
    @NamedQuery(name = "Publicaciones.findById", query = "SELECT p FROM Publicaciones p WHERE p.id = :id"),
    @NamedQuery(name = "Publicaciones.findByLike", query = "SELECT p FROM Publicaciones p WHERE p.like = :like"),
    @NamedQuery(name = "Publicaciones.findByUnlike", query = "SELECT p FROM Publicaciones p WHERE p.unlike = :unlike"),
    @NamedQuery(name = "Publicaciones.findByDescripcion", query = "SELECT p FROM Publicaciones p WHERE p.descripcion = :descripcion")})
public class Publicaciones implements Serializable {
    private static final long serialVersionUID = 1L;
    // @Max(value=?)  @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation
    @Id
    @Basic(optional = false)
    @NotNull
    @Column(name = "id")
    private BigDecimal id;
    @Column(name = "LIKE")
    private BigInteger like;
    @Column(name = "unlike")
    private BigInteger unlike;
    @Size(max = 1024)
    @Column(name = "descripcion")
    private String descripcion;
    @JoinColumn(name = "nick", referencedColumnName = "nick")
    @ManyToOne(optional = false)
    private Login nick;

    public Publicaciones() {
    }

    public Publicaciones(BigDecimal id) {
        this.id = id;
    }

    public BigDecimal getId() {
        return id;
    }

    public void setId(BigDecimal id) {
        this.id = id;
    }

    public BigInteger getLike() {
        return like;
    }

    public void setLike(BigInteger like) {
        this.like = like;
    }

    public BigInteger getUnlike() {
        return unlike;
    }

    public void setUnlike(BigInteger unlike) {
        this.unlike = unlike;
    }

    public String getDescripcion() {
        return descripcion;
    }

    public void setDescripcion(String descripcion) {
        this.descripcion = descripcion;
    }

    public Login getNick() {
        return nick;
    }

    public void setNick(Login nick) {
        this.nick = nick;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Publicaciones)) {
            return false;
        }
        Publicaciones other = (Publicaciones) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "Model.Publicaciones[ id=" + id + " ]";
    }
    
}
